# Makefile - Network analyzer

# Program name
EXE = network-analyzer

# Execution rules
.PHONY : all info clean mrproper endinfo

# Compiler
CC = gcc

# Compiler options
CFLAGS  = -W -Wall -Wextra -g `pkg-config --libs --cflags glib-2.0`

# Linker options
LDFLAGS = -lpcap

# Source files
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)

all : info $(EXE) clean endinfo

$(EXE) : $(OBJ)
	@echo "\t$^ -> $@"
	@$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

%.o : %.c
	@echo "\t$^ -> $@"
	@$(CC) $(CFLAGS) -c $< -o $*.o

info :
	@echo "------------- Network analyzer ---------------------------------"

endinfo :
	@echo "----------------------------------------------------------------"

clean :
	@rm -f $(OBJ)
	@rm -f *~
	@rm -f .~*\#

mrproper : clean
	@rm -f $(EXE)
	@rm -f traffic.plt
	@rm -f analysis.txt

